package com.lanou3g.ptp.signInDate.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.github.pagehelper.PageHelper;
import com.lanou3g.ptp.entity.SignInDate;
import com.lanou3g.ptp.signInDate.mapper.SignInDateMapper;
import com.lanou3g.ptp.signInDate.service.SignInDateService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

@Service
public class SignInDateServiceImpl implements SignInDateService {


    @Autowired
    private SignInDateMapper signInDateMapper;


    @Override
    public List<SignInDate> findAll(Integer page, Integer size) {
        PageHelper.startPage(page,size);
        return signInDateMapper.findAll();
    }


    @Override
    public SignInDate findById(Long id) {
        return signInDateMapper.findById(id);
    }


    @Override
    public void insert(ArrayList<SignInDate> signInDates) {
        signInDateMapper.inserts(signInDates);

    }

    @Override
    public void delete(Long id) {
        signInDateMapper.delete(id);

    }

    @Override
    public void deletes(Long[] ids) {
        signInDateMapper.deletes(ids);

    }

    @Override
    public void update(Long id, SignInDate signInDate) {
        signInDate.setUpdateTime(new Date());
        signInDateMapper.update(id,signInDate);

    }



    @Override
    public void deleteByTaskId(Long taskId) {
        signInDateMapper.deleteByTaskId(taskId);
    }

    @Override
    public List<SignInDate> findSignTime(Long taskId) {
        return signInDateMapper.findSignTime(taskId);
    }

    @Override
    public void deletesByTaskIds(Long[] ids) {
        signInDateMapper.deletesByTaskIds(ids);
    }
}
